package com.attendance.controller;

import com.attendance.common.CommonResult;
import com.attendance.pojo.Course;
import com.attendance.pojo.Pages;
import com.attendance.service.impl.CourseServiceImpl;
import com.attendance.vo.CourseVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/course")
public class CourseController {

    @Autowired
    private CourseServiceImpl courseService;

    //查询课程
    @GetMapping("/selectAllCourse")
    public CommonResult selectAllCourse(Pages pages){
        return courseService.selectAllCourse(pages);
    }

    //条件查询课程
    @GetMapping("/selectCourse")
    public CommonResult selectCourse(CourseVO courseVO,Pages pages){
        return courseService.selectCourse(courseVO,pages);
    }

    //插入课程信息
    @GetMapping("/addCourse")
    public CommonResult addCourse(Course course){
        return courseService.addCourse(course);
    }

    //更新信息
    @GetMapping("/updateCourse")
    public CommonResult updateCourse(Course course){
        return courseService.updateCourse(course);
    }

    //删除信息
    @GetMapping("/modifyCourse")
    public CommonResult modifyCourse(Course course){
        return courseService.modifyCourse(course);
    }

    //课程下拉框接口(所有课程信息)
    @GetMapping("/queryCourse")
    public CommonResult queryCourse(){
        return courseService.queryCourse();
    }

    //通过教师id查询课程的下拉框接口
    @GetMapping("/queryCourseByteaId")
    public CommonResult queryCourseById(int teaId){
        return courseService.queryCourseByteaId(teaId);
    }

    //通过班级id查询课程的下拉框接口
    @GetMapping("/queryCourseByclassId")
    public CommonResult queryCourseByclassId(int classId){
        return courseService.queryCourseByteaId(classId);
    }
}
